Move the main logic to more appropriate pseudo main function. (At
least out of 'parse_input' function).