refactored genParameters for efficiency