modified formatting function