Restructuring code to compartmentalize view interactions to view namespace