validated and tests written