Assignment 2 codes