button functions improvement