Minor refactoring and fix formatting