Reorganized and documented