added code based on the questions missed