Moved the tests into functions