final version for midterms