Modularize logic

Split formatters into separate files, and utilize them dynamically.