Code now calculates pi serially.