Move cmd into function.

No need to define it outside the function.
Merge pull request #8 from eaburns/dev/eaburns

Move cmd into function.