I suggest to use separate hash of parameters and iterate through it.