moved sleep location, added cache guard, added pref comments, made command code more readable