some code replacements

added function that is general for two switch statements of main
function;
changed the name for main function, new name subscribes the conduct of
the named main function;