fixed major bug in cost function ... was actually anti cost function