Fixed the error string function
Updated some functions to pass out parameters by pointer instead of reference