Corrected and added some comments.
Added TODO task.