Total refactor