New: prepareforsleep