more cleanup, refactoring