Improve  and add extra flag support