add tests for encode()
implement Reference Set Emptying