changed "plain" param to "format"  added some comments.