Created macros for return argument handling

Improved memory safety as well.