added bedtime detection