imported existing code from rx.lang.scala, tests pass