These if/for statements are long and unnecessarily confusing. Why not just use `caps_list.remove(perm)`?