Too much ifs
Fix unit tests