Fixed error in reset functionally.
Added comments