added code for on-site correlation functions