added get method which takes in an index