more flexible template and corresponding unittest