Factor out conditionals
Format