Primitive functions

Includes digital logic primitive injection!
This is ok for now.