Add util macros

This PR was created from patches from the #27 PR. We seperate them here, so we do not get this annoying long history for every type we implement.