Merge pull request #47 from mrjoelkemp/cleanup

Refactoring and code cleanup.

nice, this was probably overdue.
Support lib/ directory
generateMD tests