added new scenarios, fixing failing tests, some refactorings