Refactor DistArray __getitem__ into methods.

Closes #451.