Moved reset() function