Added validation logic