use json config file instead of flags and generalize.