added preview functionality