Code for cs533 assignment 2