finished correlate.c and learning.c