Add formatting functions and their tests