modified print changes and corrected code to validate