added validation and corrected test to pass