Reverted last 3 commits and added simpler support for foreign Arrays.