kernel from midterm