Added functionality to write tags to files