refactored some code, added in further styling