ENH: Use decorator to speed up tests + rearrange auxiliary functions