Code cleanup, removed old junk, did a lot of formatting