Added optparse, verbose mode, json output