Major cleanup and changes