Changed location of sleep routine