Heavy refactoring pt.1