Rewrite `main/1` into `main/2` to take advantage of Prolog first-argument indexing
Fix typo in arg handling.