refactor bcode