Refactoring negative number handling