more cleanup and refactor