Fixed bug (index dimensionality) and added <x>, <y> constrain