json_decode should return as an array

Minor tweaks, the json_decode function should have a second parameter to return as an array (not an object) and a small change to the addRule function to fix a variable.