added final version of gui update

The best solution that came to my mind was a new function which contains
all the code needed to update the gui. I just concatenate a call to this
function at the end of the variable update.