Rewrite to support arrays. Still missing assembly.