cleaned up time logic a bit