Refactoring & formatting