Clean up code
Fixes #1