minor codeclean and refactoring