adding nested query capability