Fix grid setup.

As suggested by @corranwebster
Factor out kiva-array creation