changed the use of index argument for getting and pushing types