validated and fixed mistakes