Main code