Added error handling to TinSubmit