moving user event binding out of template