updated button function