Fixing syntax error and removing undeed key comparisons