Refactored view and template contexts

Added Classes to hold some of the context data as dictionaries of
dictionaries of dictionaries was getting very confusing