Added functionality for dealing with sleep states