WIP: basic functionality. Midnight date advance not complete.