make unsigned int to prevent overflow warnings