move function into test