Link with libformat instead of including format.cc in every file.
Move more code from header to source.