Added support to maintain values when switching views