working for negative numbers.