Little code revision and more tests