format code and add comments