Refactored functional tests to get rid of cruft and maintain DRY