added error handling logic
added settings