Macros to inline functions

Macros are hard to debug, making them inline functions would be helpful