Fixed a bug with the SleepDetector. Basic functionality works.