working code at the end of lab thursday