Transform/refchecks

RefChecks are now in, ad quite a few things had to be done to make it happen.

This PR depends on #161 and #162. They should be reviewed and committed first.

review by @DarkDimius and generally up fro grabs.