Change computeTimes function to use Writer