Started big code refactoring (cleaning up a log of horrible code).