refactor bx and add tests and restart docs