moving test logic out