added onError, onTimeout, and indicator functions.