Code cleaning main_function completed