Spark pca refactor

Hi @deflaux thanks for all the feedback, please take a look at this refactor and let me know any changes you still consider need to be done to make this code as readable as required. 

Fixes #30 and #29. 

Thanks!