formating and refactoring