removed redundant if clauses