Wrapped macros a bit more, fixed a couple of bugs