improvements to button functionality using jquery