Reorganize source files.
Add some documentation.