(and it should handle the possiblity that x is out of range and that the original X and Y values may be invalid)