Removed some unneeded double if statements