added long options and support for test cases