split module in classes and improve tests