logic of determination the pier of destination

Some changes in that