Changed maxDifference argument to int16_t