Clean up models, add some error handling