made refine_and_coarsen_optmise easier to read and less error prone
Merge pull request #287 from davydden/refinement_optimized

refine_and_coarsen_optmise