The mystery of the trailing tab resovled; bug in the duplicate checking
fixed; minor fixes