Got rid of hard coded index