queries init outside if block
working extraction final