Midterm code

Source code for mid term