Code review

Change code to avoid useless processing