Added timeout and error callback