Script to convert to new schema.
Updated test database with new schema.
Remove unused functions.