Refactor to functional tests.