found another major bug; started fixing by making new CostFunction class. A system can create one and a descent direction has one as an attribute