[WIP] QB refactoring

/cc @dantleech