Made changes as per the homework