Reviewed code and added some comments.