src refactored, manpage rewritten, tests written