added support for negative numbers