adds validation logic