Polygon class is converted, but not thoroughly tested.
Fixed typo with logical operator.