Added validation and fixed a typo