Refactor with resetStatus function