Adds error handling and database options