Fix gateway sorting and change gw naming scheme