Added support for negative numbers
Restructure to allow overriding of default behaviour