adding code from video 50