Added error handling
Error handling is done on spot