Huge refactoring. Again.