refact testinq using code