added range based loop for coordinates