updated tests, some refactoring