Preview functionality cleanup

I originally had that, and I changed it. 
@simi what do you think?