moved click handler into spice callback function