Having your if's in the right place