improved button funcitonality