Refactoring and rewriting everything