Added error handling capability