Rework the javascript file of the UI (part3)