added cost and changed some mistake