started adding cost functions