Added x/y sorting to grid layout