JS revision

Eliminated a bug when the button is rapidly clicked.