Source code refactoring

This functionality also possibly opens up easy extension of new similar costs into the same functionality without copying and pasting code. 
You might want to build your code before committing it. this is missing a `;`.