modified correlation.py