Bug using same variable to iterate nested for. Fixed
Selection of the closest previous timestamp. Fixes #80