Main code of APP