Main code structure