added proper error handling
added more details