added error handler and chnaged library.