added regression test, doc comments, and command line usage help