added condition generation code