code clean, add message logging to mnesia.