rewrite to rxjava, needs lots of refactoring