Assign ids for top two levels
Continue if query string is invalid