Use else if instead of two ifs