Removing non necessary ifs
Improving tests