Helper functions added to fix negative number issues.