added preview functionality.