refactor preview