added auto preview feature