Added cmdarg parsing in preparation for large-scale experiments and testing. Also a little housekeeping.