added write option and print every point