Implementing the sleep mode