Fixes/gh11 apply cost

This fixes #11 partly by adding a Cost class.