started refactoring of Core into a bifunctor