remove redundant if and add more coments