Changes to setter and getter.

Now, setter and getter methods accept indices.