build reset function