code cleanup: added missing var, used var instead of "this"
BugFix: don't attach new handlers every time the plot is redrawn