modify other functions to use mnesia