Changed loop indexes to uints.