Little refactory and more a few tests