ref 23524
Added additional tests and refactored