cost function hsa been implemented