added id and sorted atypes