Added calculating move cost.