Work on command line opts, fix minor bugs