Restored rest of code after core/operation refactoring.

bexp should be refactored as well.