cleaned up rcalc