moved order of test to the end