Refactoring, cleanup, removed junk.