Adding most of KPMF, will finish tomoorw (probably need to stick with gradient descent first pass