update the top bar function.