initial code for xgener