Change if structure a bit