avoid using globals. see #87