copies timezone stuff from 1.11.x
numerous code cleanups.