Edited testing routines and trying to fix rigid periodic mindist class