Work on array support

Fixes #484 and #821