Proper reset support; adding test code to verify functionality.