Changed main function