Separated reset into a function