Remove somme unused function and simplify some others