Added logic for waggon assignation