Use HexFormat instead of custom code