add comments
use variable for file name
delete the redundant local variables
add comments