Changed time loop from for to while-- lower memory use.