refactor FormatTemplate constants, add comments