removed unnecessary ifs