Added pickling support and command line interface