Restructure database schema, update data access logic