I am not sure this function is the best place for saving the configuration. The name of the function is renderElements. Maybe storing the configuration can be moved to a more appropriate place.