Comments added to functions + some modifications

Changed $.toJSON and $.parseJSON to JSON.stringify and JSON.parse since those provide objects and we need arrays
JSON method are supported by IE>6 so there should not be a problem or otherwise we will have to add json2 file from douglas
Also added comments to function description