new_page function and fixed previewing