updated error handling added new methods