First version (need more tests)