Heavily refactoring