Remove not necessary check.
Remove repeated code.