Update documentation, error checking, and reorganize files.