refactor method to exit early if needed