Added code for lab 3 exercise