added ViewMode.js pseudocode