Factored out the pca transformations, needs testing