schema changed and nested query added