Slightly modified the algorithm of smart container, to let left x have more priority.
Don't test if the position has been taken up by a box.