added var declaration to viewMap.