refine and optimize tests