switched it from unit8_t to int to allow larger values