now works with mnesia