Refactored codebase to share primitives between front end and back end

Depends on #124 

Logically merged frontend and backend value systems.