modified Pcost to work with Yaml