Added x coordinate wrapping