optimize

usage of test function in loop should be avoided.