Anyway, it's hard to say much more with so little info, but my basic answer to your question is "probably". Probably, yes, you can continue on with seo changes despite the old code, unless that code is actually preventing the bots from doing their job.
Like Donna says, it's not clear from what we know, but the odds are your code bloat and your SEO efforts are different issues. Use Google's advanced search to make sure your pages are all being indexed and can be found at all through search. If they are, the "optimization" part of SEO will start by making sure meta data is correct -- title and description tags. Making sure headings are clear and include your target keywords. Making sure the content itself is compelling, well written, and reasonably optimized for your keywords. All those on-page factors are not necessarily heavily influenced by bad coding, and some, like the meta data, probably not at all. Off-page factors like link building will make the biggest difference in your rankings, and that has nothing at all to with coding.
So in a world where resources and time may be limited, if SEO is a priority, cleaning the code may not be the best first step from a purely pragmatic point of view.
On the other hand ... a short investment in cleaning up and making the site easier to manage and easier to update may save you time in the long-run.
Edited by FrankElley, 29 September 2009 - 10:00 AM.