split js functions from button handlers