add Main function code