make the mode function into dream\application and modeManager