styling and a bit of refactoring