Fixed query and indexing.

* Looked for extensions in the p:ExternalSignature.
* Removed the LIMIT clause on the query. Doh!
* Stored the extension in the JSON object.
* Updated the output JSON.