added preliminary support for duplicate detection; press 4 key in game to test