Adding optimizations for taking array difs