Add copyright and licensing headers, and docstrings.
Merge pull request #8 from adamgreig/copyright

Copyright headers etc