The Main Code