Rearranged the code so that observable returned from the func has complete control over when the source observable is subscribed.
Made scan less lazy.