Added two new functions as according to the homework