Do compile time checks of literal map values
Move some useful functions into misc.c