First half of Assignment 2