Fixed problem with cost computation, added some assertions and added some more precise debugging printing
Fixed problem with cost computation, added some assertions and
added some more precise debugging printing

Godzil/ack,Godzil/ack,Godzil/ack,Godzil/ack,Godzil/ack