Added error checking and changed functions to return int (for error handling) and modify objects passed by parameter