Added a utility function relative

Strips away the parent part (if any) from an ID.
Cleaned up mapping module
Added some constants to q
Cleanup in generators and generator tests