Removed usage of global variables and instead pass the variables along to each step of the way while rendering and paging through views.
Fixed merge conflicts.