changed index and added better controls