code: midterm attempt one