split format into separate file in lib directory and change some coloring