Move prims to backend.

Implementing a few more reductions.