best refactor ever