added save loop for coordinates