separated main from class, to maximize reuse
fixed iterator in main to not count the first point twice