Added weight > 0 check before getting costs