Longest prefix matching implemented