Big Cleanup

Lots of clean up & reordered the functions.
Added comments on what is happening.
Cleared out the objects after use.