Added data cleaning to correlation function