moved rpc actions to factory for easier testing