Refactoring and auto format