Refactored away 75% of function app_viewStack in file view_stacks.js