move flag parsing to init()