refactor the stuff