changed preview functionality