mapping both ways
everything should be implemented, needs tidying up a lot
added pretty-print. seems to be normalized and working