Moved all event handling code for buttons to WakTmpl.js