simplified conditions in meshing algorithm

got rid of the goto statement