You're really going to want to reformat the code in your original post to look like that. Also, where is the file list coming from? You've left the juicy bits of your code out of these snippits, and I'm afraid that I'm just not good enough to be able to make an intelligent guess without seeing what you're doing.
If you are really confident that your internals are working just fine and can't post them here, might I suggest you look into using the debugger?