Pulling out a method to remove multiple returns