Modifed index to actually work