Added error management
Added duration