improve logic and specify api pass limit