implemented test mode.