rules api; fixes #7