added cost function. preparing to write update openList function