Adding preview functionality