Above 3 ifs in one if makes it a lot smaller and easier to test the function ;)