factor out formatObjects
Factor out outputObjects