Factorize code
Remove useless imports