Implemented toCString and improved some functions