Made changes after code discussion.