Refractoring of main