more unit tests. Some refactoring