working on dynamic pages loop