cleaned main_*() functions