fixed up midterm a bit