Code corrected, comments added.