Added cost and tests