Improve sleep mode and keep track of sleep pin status