added functions to format.c