nano modified main function