Add the detection of the borders when moving