implemented validation logic