added handling for negative values