restructured package and added envflag