Refactor SelfMgr to use State Design Pattern.