added some comments, replaced string format