minor changes to fix date and month sorting (was previously outputting in reverse order)