Replaced macros with functions cause I'm using exceptions now