Coordinate conversion replaced with CLR functions, now works correctly with Cartesian coordinates.