updated code from video 12