refactor app.sj