moving math script bind code to templates
handle mouse capture when the system events are received