polishing and corrections. + added sort checker script.