added the capability to specify a custom wait period