Modified controller to automatically update values