add new unit tests and extend to cover all cases
add new unit tests and extend to cover all cases