LAST CHANGES TO RESET FUNCTION