Overhaul of the usage of active resources, moved much of the prim engine logic into prim fe.