Re-implemented checking to see if it's safe to merge.