Updated s.t. it can handle if no moves are availbe