Changed main function.