Refactor of setControlMode