add preview functionality