detection of main, handling of type menu