Move logic into helper methods