renamed and refactored
more cleanup and fixes