rf code cleanup
Not using formula interface makes it slightly faster