The flatten is here because we are mapping timestamps to arrays.  Without the flatten we'd have an array of arrays, with each member of the outermost array an array of jobs scheduled under that timestamp.

I'm not usually a fan of initializing an empty array and then mucking with it inside an each, but can do that if you think it reads better.