Resubmitting @jlee-r7's #2505 with fixes

Since msfcli blew up. My bad.

See #2505 for discussion on what broke.