Stored queries improvements