implementing Dmitri Perunov's advice. closes #77