Fix a bug (issue #7).
Cleanup code.