Added fix for negative numbers