Decimal-to-binary refactored with helper methods