lots of refactoring comments and layout.