try to split main function and beautify code...