refactor to use function+filter test helpers