Develop main function