replaces lots of macros with stdlib funcs