BS-9856
Fix validation
Refactor + unit tests