refactor for cleaner conditionals