extended documentation; corrected sorting