cleaned up some of the function reset code
cleaned up some of the function reset code