updated with working correlation measurement