First-pass at moving arsenal generating functionality into functions.
Fix some typos and compiler errors.