Refactoring and test PageRank