lib: start implementing the PBS backend (WIP!)