code from half way through class