Changed x and y fields to IXYPair and implemented some methods