Modified main function.