update validation and added Unit Tests