little bit of cleaning and refactoring