Added validation logic.