SOAP-1411
* Added test scenarios
SOAP-1411
It works! Did some refactoring, and added unit tests.