update_list function: replaced self.mode to mode: mode as argument of function