rewrite to add set and delete functionality