add main function code