another attempt to try and deduplicate formatter code