Some refactoring
Some tests