Completed most of PCA implementation