Reorganization, cleanup and comments