Reactive programming exercise in scala