Added the homework 2 functionality