Several modifications to add more tests
Merging Iryna's changes