take the first occurence of delim and compute id and type accordingly. This works with the case when the id has the delim character in it.