Update docs. Reorganize code.