improved button functionality