Added configurable timeout to Providers
Fixed issues with locking and flushing
Fixed logic bug