Major refactoring of all top-level files. Include doc comments for all public functions and methods.
Add copyright notice to all files