Added code to save tags.