Add q key to exit. Remove useless thread.