Refactored once more the formatHoldings function.