added check to enable optimal packing, all the way up against the wall