Try combining the sandstone functions into one that covers both IDs.