reorganise the objects to fit inside the boxes