Created a viewMap instead of recreating views when moving back and forth between view and search. Use the switchtorenderview function consistently.