Feature/format comments

Refactored the format comments code.