Refactor man script and add tests.