Add tests for future weighted cost.
Refactor.