Improving on containsActiveDocument handling -- still not quite though.