Added consistency check and pca