added flavor arg and some more imporvements