replace usage of test with internal function