refactor  edit and replace label text

remove global var firstText and create function change_input