remove macros, add functions

This PR rewrites existing messy macros to very clean functions.

Of course this closes #5