Refactored window.viewStore to move variables into the object.