better documentation, encoding, add method to clear rules