Attempt to refactor out a bit more complexity