complete main code structure