Convert macros to inline functions