added some comments
added the preview mode