update function

made function to run everytime a change needs to be displayed