added reset.  cleaned up code