changed to using rxjs