Refactor code to read easier. All tests pass.