refactoring Bcode service