Major Edit: More documentation and cleanup.