Fix an incorrect var name.
formatting.
Added tests and some bug fixes. Also now generate the n7 bash script from Leo outline.