Move licensing
Declare functions as local vars then assign
Fix broken references
Merge pull request #1 from paulkaplan/master

Clean up some minor issues