Add ami functions
Some simplifications using jq...