Added live preview and some formating functions