Added x and y constraints code