add formatSource function