refactor for rx