removed double if's