this is a backup of sleep code