Huge refactoring for base abstraction