rewrite to use new format