-refactoring and cleanup