added dynamic page loop