refactor SleepMode.java to interrupt thread properly