Refactored and documented the pair correlation function