Added support for negative numbers and fixed use of integers only.