Organization of main code