Begin huge refactoring