Add option parsing, among other changes