Small refactor to clean up code