wrote param generate function, needs debug