a quick refactor