added some comments.
optimize and exports.
optimize.
rename veriables.
implemented a loop function.
modified