well modularized code with anderson darling