Added cost return.

Still has a strange error in the tests.