Refactoring code to look nicer and easier to read