Refactor out more lines of code