restructured appjs, and views