Added timeout error
Added error checks