refactoring and formating