refactor if's