returning proc from expand_query