A set of minor cleanups plus remove one gettimeofday()