Added the homework 3 functionality