made adding pages dynamically work