Extracts generic code to create cost with a threshold
* #323
Notes change to background cost
* #323