MAJOR REFACTORING: