Split bc.cpp into separate functional components; introduced namespaces