Added multi-page support