format logic