Minor refactoring and clean