refactoring and styling changes