Added generate and locate commands, with dedicated functions. Added rudimentary JSON output.