Added logic to properly handle large numbers