Replaced main function.