Better reset implementation. Tidy up client code.