Assignment 1 codes