Updated schema and queries