rough draft of PCA code