Abstract the format choices into a function