switch replaced with if's