Add key repeat in main function.