migrate to logging, optparse