Improving date handling code, adding support for stderr and stdout.