Clean up
Remove dead code
Refactor
Fixes #178
Clean up
Test for #180
Fixes #180