refactored out cache model patterns and globalUI cache

made statemodel individual model file, took out global ui cache,
rendering header view in app.js