script to convert to new DB layout