Added optional delay parameter.