2.5SDK fixes and resource frees

I've updated your code to compile with SDK 2.5, and also fixed the not freed up resources.

I haven't tried it out, but it should still work, It won't fix the loading bug though (sometimes when you go back to the main window you get the loading... text and nothing appears).