Cleanup

This branch depends on #8 and does some general cleanup on top.