Full refactoring and more