main func structure