refine app architecture