Implement array subscripting, and some code cleanup.