Updating the code as per Tim’s feedback