reorganizing parameters to avoid weird loop