Remove duplicates, fix rules