Do you have some sample input? PJ Plauger wrote a great set of essays called Programming on Purpose and one of them said the structure of the code often looks like the structure of the input. It's hard to guess what the program will look like without knowing what the data looks like.
Of course, another essay said the structure of the program often looks like the structure of the OUTPUT. Heh heh heh.