Assignment 2 source codes