code refactoring/clean up