Updated out of date CHANGELOG.md.
A bit more refactoring.
Added shebang