last reference version of sum cost function before getting swapped with faster one