refactored function to computed the whole test + improved plots + removed useless imports