code was fine, just needed to recalculate R_pi values