Refactor

Extracted methods nightTime() and sleepUntil(..) to make it easier to read.