on click data handler fix, and used function references for callbacks