refactor like mad