bugfixes for FF, check for duplicates, refactoring