Add a listener to update the elements