added the validations the slide suggested