added multipage support