added rigorous test for main routine