added reset function; refactored validate functions