Refine test and make it more portable.