Improve extension to product structure generation

- improvements to obtain correct reaction degeneracy 
- replace while loop with if conditions