anchor.diff:  	    Min = jsonschema:keyword(Schema,"minimum"),
   	    ExcMin = jsonschema:keyword(Schema,"exlusiveMinimum",false),
   	    Mul = jsonschema:keyword(Schema,"multipleOf",1),
  -
  -
  +            
  +            
   	    case {Min, Max} of
  -
  +                
   		{undefined, undefined} ->
   		    number();
   		
   		{Min, undefined} ->
   		    number_mul_min(Mul,Min,ExcMin);
  -
  +                
   		{undefined, Max} ->
   		    number_mul_max(Mul,Max, ExcMax);
   		
   		{Min,Max} ->
   		    number_mul_min_max(Mul,Min,Max,{ExcMin,ExcMax})
   	    end;
  -       
  -
  -
  +        
  +
  +        
           %% null
           %%     The JSON null value. 
           <<"null">> ->
               null();
  -
  -
  +        
  +        
           %% object
           %%     A JSON object.
           <<"object">> ->
               P = jsonschema:properties(Schema),
  -	    MaxProp = jsonschema:keyword(Schema, "maxProperties"),
  +	    MaxProp = jsonschema:keyword(Schema, "maxProperties", ?MAX_PROPERTIES),
   	    MinProp = jsonschema:keyword(Schema, "minProperties", 0),
  -	    Required = jsonschema:keyword(Schema, "required",[]), %% values from properties
  +	    Required = jsonschema:keyword(Schema, "required",[]),
  +            PatternProp = jsonschema:keyword(Schema, "patternProperties",{}),
   	    ReqList = lists:filter(fun({M,_}) -> lists:member(M, Required) end,P),
   	    OptP = lists:filter(fun({M,_}) -> not (lists:member(M, Required)) end,P),
  -
  +            
   	    io:format("Required is: ~p~n",[ReqList]),
   	    io:format("Not Required is: ~p~n",[OptP]),
  -
  -
  +            
  +      %% BETA -->
  +            %% case PatternProp of
  +            %%     true ->
  +            %%         [];
  +            %%     false ->
  +            %%         OptP++ = OptP;
  +            
  +            %%     Schema ->
  +            %%         OptP++ = [Schema | OptP]
  +            %% end,
  +            
               case MinProp - length(ReqList) < 0 of
                   true -> Min = 0;
  -
  +                
                   false -> Min = MinProp - length(ReqList)
               end,
  -
  +            
               ?LET(L, filterProp(OptP, {Min, MaxProp - length(ReqList)}),
   		 {struct, lists:map (fun ({M,S}) ->
   					     {M,json(S)}
   				     end,
   				     lists:append(ReqList,L))});
  -
  -
  +        
  +        
           %% string
           %%     A JSON string.
           <<"string">> ->
   	    MinLength = jsonschema:keyword(Schema,"minLength"),
   	    MaxLength = jsonschema:keyword(Schema,"maxLength"),
   	    Pattern =  jsonschema:keyword(Schema,"pattern"),  %% to be added later
  -
  +            
   	    %% Currently we do not like length specifications 
   	    %% combined with regular expressions. Will this change? 
   	    %% Maybe, it is not easy to do.
   	    if
  -	      ((MinLength=/=undefined) orelse (MaxLength=/=undefined)) andalso
  -	      (Pattern=/=undefined) ->
  -		io:format
  -		  ("Specifying both minimum or maximum string lengths "++
  -		     "and a regular expression is not currently supported"),
  -		throw(nyi);
  -	      true -> ok
  +                ((MinLength=/=undefined) orelse (MaxLength=/=undefined)) andalso
  +                (Pattern=/=undefined) ->
  +                    io:format
  +                      ("Specifying both minimum or maximum string lengths "++
  +                       "and a regular expression is not currently supported"),
  +                    throw(nyi);
  +                true -> ok
   	    end,
  -
  -	if 
  -	  (MinLength=/=undefined) orelse (MaxLength=/=undefined) ->
  -	    case MinLength of 
  -	      undefined -> 
  -		Min = 0;
  -	      _ -> 
  -		Min = MinLength
  -	    end,
  -
  -	    case MaxLength of
  -	      undefined ->
  -		Max = ?MAX_STR_LENGTH; 
  -	      _ ->  
  -		Max = MaxLength
  -	    end,			
  -	    
  -	    ?LET(Rand,randInt(Min,Max), 
  -		 ?LET(S, stringGen(Rand), list_to_binary(S)));
  -
  -	  %% Regular expression pattern specified
  -	  true ->
  -	    RegularExpression = binary_to_list(Pattern),
  -	    InternalRegularExpression = regexp_parse:string(RegularExpression),
  -	    ?LET
  -	      (String,
  -	       gen_string_from_regexp:gen(InternalRegularExpression),
  -	       list_to_binary(String))
  -	end;
  -
  +            
  +            if 
  +                (MinLength=/=undefined) orelse (MaxLength=/=undefined) ->
  +                    case MinLength of 
  +                        undefined -> 
  +                            Min = 0;
  +                        _ -> 
  +                            Min = MinLength
  +                    end,
  +                    
  +                    case MaxLength of
  +                        undefined ->
  +                            Max = ?MAX_STR_LENGTH; 
  +                        _ ->  
  +                            Max = MaxLength
  +                    end,			
  +                    
  +                    ?LET(Rand,randInt(Min,Max), 
  +                         ?LET(S, stringGen(Rand), list_to_binary(S)));
  +                
  +                %% Regular expression pattern specified
  +                true ->
  +                    pattern_gen(Pattern)
  +
  +                    %% RegularExpression = binary_to_list(Pattern),
  +                    %% InternalRegularExpression = regexp_parse:string(RegularExpression),
  +                    %% ?LET
  +                    %%    (String,
  +                    %%     gen_string_from_regexp:gen(InternalRegularExpression),
  +                    %%     list_to_binary(String))
  +            end;
  +        
           %% any
           %%     Any JSON data, including "null".
           <<"any">> ->
  
positive.code: 			    Max = MaxScanned
  		    end
  	    end,	    
  
  
  	    case MinScanned of
  		undefined -> Min = undefined;
  		
  
negative.code:         %% integer
          %%     A JSON number without a fraction or exponent part. 
          <<"integer">> ->
              
  	    MaxScanned = jsonschema:keyword(Schema,"maximum"),
  	    ExcMaxScanned = jsonschema:keyword(Schema,"exclusiveMaximum",false),
  	    MinScanned = jsonschema:keyword(Schema,"minimum"),
  	    ExcMinScanned = jsonschema:keyword(Schema,"exclusiveMinimum",false),
  	    Multiple = jsonschema:keyword(Schema,"multipleOf",1),
  	    
              % Setting up keywords
  	    case MaxScanned of
  		undefined -> Max = undefined;
  		
  