draft edition of cost funciton