corrected mistake in routing to preview page
refactor