Implementing roletorxn function