add reset() method to prevent memory leaks