refactored js call to buttons