refactor to great