Refactored code to use Rx instead of Thread.Sleep