updated button logic