refactor hell.