sleep detection works