Add warning function and cleaned stop at the end