Fix midnight code so it's simpler.