Major refactoring, remove old contract primitives