Templates edited to match API. Not tested.