refactor app , cannot run correctly currently