code cleanup: int -> unsigned int for indices