added msg class

added global msg function
added doWrite function to make all the saves/changes