Remove duplicate code

Fixes #44.