remove static variable, add limit and offset