updated code, added ancestry and some validations.