added preview option and few other fixes