Returning 0 if all went well, and 1 if not