[BRK] Huge refactoring of old code.