Refractoring + Tests