Added delete preview and reformated code