original downloaded code from CMU