you can merge these 3 ifs into 1