Basic time handling is in place, and the code was refactored a bit.