Removed quite a bit of obsolete code, and added the calls to write the pre-declarations and post-includes.