added build script, and switched to mnesia